use "repdata.dta"

#delimit ;
drop if onset == 4;
reg onset warl gdpenl lpop lmtnest ncontig Oil nwstate instab
    polity2l ethfrac relfrac;
gen ytilde = onset - _b[instab]*instab;
reg ytilde lmtnest ncontig Oil ethfrac relfrac;
#delimit cr

capture program drop deboot
program define deboot, rclass
  #delimit ;
  regress onset warl gdpenl lpop lmtnest ncontig Oil nwstate instab
    polity2l ethfrac relfrac;
  replace ytilde = onset - _b[instab]*instab;
  reg ytilde lmtnest ncontig Oil ethfrac relfrac;
  return scalar deffect = _b[ethfrac];
  #delimit cr
end

bootstrap deffect=r(deffect), reps(100) seed(12345): deboot
